<template>
  <div class="footer-container">
    <!--左侧的全选-->
    <div class="custom-control custom-checkbox">
      <input type="checkbox" class="custom-control-input" id="cbFull" :checked="isFull" @change="fullChange">
      <label class="custom-control-label" for="cbFull">全选</label>
    </div>

    <!--中间的合计-->
    <div class="footer-center">
      <span>合计:  </span>
      <span class="total-price">￥{{amount.toFixed(2)}}</span>
    </div>
    <!--结算按钮-->
    <button type="button" class="bth bth-primary btn-settle" @click="pay">结算 ({{all}})</button>
  </div>
</template>

<script>
export default {
  props: {
    isFull: {
      type: Boolean,
      default: true
    },
    //总价格
    amount: {
      default: 0,
      type: Number
    },
    //已勾选的商品总数量
    all: {
      typ:Number,
      default: 0
    }
  },
  methods: {
    fullChange(e) {

      this.$emit('full-change',e.target.checked)
    },
    pay() {
      alert('确定支付人民币：'+this.amount+'元')
    }
  }
}
</script>

<style lang="less" scoped>
.footer-container {
  font-size: 12px;
  height: 60px;
  width: 100%;
  border-top: 1px solid #efefef;
  position: fixed;
  bottom: 0;
  background-color: lightcyan;
  display: flex;
  justify-content: space-between;
  .total-price {
    color: red;
  }
  .btn-settle {
    background-color: skyblue;
    color: red;
    width: 20%;
    margin: 10px;
    border-radius: 20px;
  }
  .footer-center {
    color: red;
    width:25%;
    margin: 10px;
    text-align: center;
    line-height: 40px;
  }
  .custom-checkbox {
    color: red;
    width:25%;
    margin: 10px 0 10px 0;
    padding: 0;
    text-align: left;
    line-height: 40px;
  }
}

</style>